﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InfonavaEye.util
{
    public class MathUtil
    {
        /// <summary>
        /// 求2个点连成的线的角度
        /// 点1 (x1,y1)
        /// 点2 (x2,y2)
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <param name="c"></param>
        /// <param name="d"></param>
        /// <returns>角度值</returns>
        public static double anglevalue(double x1, double y1, double x2, double y2)
        {
            double rangle = Math.Atan2(y2 - y1, x2 - x1);//求弧度值
            return rangle / Math.PI * 180;//求角度
        }

        /// <summary>
        /// 求2个点连成的线的距离
        /// 点1 (x1,y1)
        /// 点2 (x2,y2)
        /// </summary>
        public static double calcDistance(double x1, double y1, double x2, double y2) {
            return Math.Sqrt(Math.Pow(Math.Abs(x2-x1), 2.0)+ Math.Pow(Math.Abs(y2-y1), 2.0));
        }
    }
}
